﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AMing.Core.Method
{
    public static class StringHelper
    {
        /// <summary>   
        /// 移除HTML标签   
        /// </summary>   
        /// <param name="HTMLStr">HTMLStr</param>   
        public static string RemoveHtmlTag(this string HTMLStr)
        {
            return System.Text.RegularExpressions.Regex.Replace(HTMLStr, "<[^>]*>", "");
        }
        /// <summary>
        /// 过滤脚本
        /// </summary>
        /// <param name="content"></param>
        /// <returns></returns>
        public static string FilterScript(this string content)
        {
            string regexstr = @"(?i)<script([^>])*>(\w|\W)*</script([^>])*>";
            return Regex.Replace(content, regexstr, string.Empty, RegexOptions.IgnoreCase);
        }
    }
}
